| <?php | = | <?php |
| /* | /* | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | CubeCart v3 | | CubeCart v3 | |
| | ======================================== | | ======================================== | |
| | by Alistair Brookbanks | | by Alistair Brookbanks | |
| | CubeCart is a Trade Mark of CubeCart Limited | | CubeCart is a Trade Mark of CubeCart Limited | |
| | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | |
| | CubeCart Limited, | | CubeCart Limited, | |
| | 5 Bridge Street, | | 5 Bridge Street, | |
| | Bishops Stortford, | | Bishops Stortford, | |
| | HERTFORDSHIRE. | | HERTFORDSHIRE. | |
| | CM23 2JU | | CM23 2JU | |
| | UNITED KINGDOM | | UNITED KINGDOM | |
| | http://www.CubeCart.com | | http://www.CubeCart.com | |
| | UK Private Limited Company No. 5323904 | | UK Private Limited Company No. 5323904 | |
| | ======================================== | | ======================================== | |
| | Web: http://www.cubecart.com | | Web: http://www.cubecart.com | |
| | Date: Tuesday, 17th July 2007 | | Date: Tuesday, 17th July 2007 | |
| | Email: sales (at) cubecart (dot) com | | Email: sales (at) cubecart (dot) com | |
| | License Type: CubeCart is NOT Open Source Software and Limitations Apply | | License Type: CubeCart is NOT Open Source Software and Limitations Apply | |
| | Licence Info: http://www.cubecart.com/site/faq/license.php | | Licence Info: http://www.cubecart.com/site/faq/license.php | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | transfer.php | | transfer.php | |
| | ======================================== | | ======================================== | |
| | Core functions for the PROTX Gateway | | Core functions for the PROTX Gateway | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | Thanks to Ben XO for Bug Fixing ( xo at dubplates dot org ) | | Thanks to Ben XO for Bug Fixing ( xo at dubplates dot org ) | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| */ | */ | |
| /* | /* | |
| ////////////////////////// | ////////////////////////// | |
| // PROTX GATEWAY | // PROTX GATEWAY | |
| ////////////////////////// | ////////////////////////// | |
| // L@@K AT ALL THE LOVELY | // L@@K AT ALL THE LOVELY | |
| // VARIABLES WE HAVE TO | // VARIABLES WE HAVE TO | |
| // PLAY WITH!! | // PLAY WITH!! | |
| ////// | ////// | |
| ////////////////////////// | ////////////////////////// | |
| // IN THE REPEATED REGION | // IN THE REPEATED REGION | |
| ////// | ////// | |
| $orderInv['productId'] - product id as an integer | $orderInv['productId'] - product id as an integer | |
| $orderInv['name'] - product name as a varchar | $orderInv['name'] - product name as a varchar | |
| $orderInv['price'] - price of each product (inc options) | $orderInv['price'] - price of each product (inc options) | |
| $orderInv['quantity'] - quantity of products as an integer | $orderInv['quantity'] - quantity of products as an integer | |
| $orderInv['product_options'] - products attributes as test | $orderInv['product_options'] - products attributes as test | |
| $orderInv['productCode'] - product code as a varchar | $orderInv['productCode'] - product code as a varchar | |
| $i - This is the current incremented integer starting at 0 | $i - This is the current incremented integer starting at 0 | |
| ///////////////////////// | ///////////////////////// | |
| // FIXED VARS | // FIXED VARS | |
| /////// | /////// | |
| $cart_order_id - cart order id as a varchar | $cart_order_id - cart order id as a varchar | |
| $ccUserData[0]['email'] - Customers email address | $ccUserData[0]['email'] - Customers email address | |
| $ccUserData[0]['title'] - Customers title (Mr Miss etc...) | $ccUserData[0]['title'] - Customers title (Mr Miss etc...) | |
| $ccUserData[0]['firstName'] - Customers first name | $ccUserData[0]['firstName'] - Customers first name | |
| $ccUserData[0]['lastName'] - Customers last name | $ccUserData[0]['lastName'] - Customers last name | |
| $ccUserData[0]['add_1'] - Invoice Address line 1 | $ccUserData[0]['add_1'] - Invoice Address line 1 | |
| $ccUserData[0]['add_2'] - Invoice Address line 1 | $ccUserData[0]['add_2'] - Invoice Address line 1 | |
| $ccUserData[0]['town'] - Invoice Town or city | $ccUserData[0]['town'] - Invoice Town or city | |
| $ccUserData[0]['county'] - Invoice County or state | $ccUserData[0]['county'] - Invoice County or state | |
| $ccUserData[0]['postcode'] - Invoice Post/Zip Code | $ccUserData[0]['postcode'] - Invoice Post/Zip Code | |
| $ccUserData[0]['country'] - Invoice country Id we can look up the country name like this | $ccUserData[0]['country'] - Invoice country Id we can look up the country name like this | |
| countryName($ccUserData[0]['country']); | countryName($ccUserData[0]['country']); | |
| $ccUserData[0]['phone'] - Contact phone no | $ccUserData[0]['phone'] - Contact phone no | |
| $ccUserData[0]['mobile'] - Mobile/Cell phone number | $ccUserData[0]['mobile'] - Mobile/Cell phone number | |
| $basket['delInf']['title'] - Delivery title (Mr Miss etc...) | $basket['delInf']['title'] - Delivery title (Mr Miss etc...) | |
| $basket['delInf']['firstName'] - Delivery customers first name | $basket['delInf']['firstName'] - Delivery customers first name | |
| $basket['delInf']['lastName'] - Delivery customers last name | $basket['delInf']['lastName'] - Delivery customers last name | |
| $basket['delInf']['add_1'] - Delivery Address line 1 | $basket['delInf']['add_1'] - Delivery Address line 1 | |
| $basket['delInf']['add_2'] - Delivery Address line 1 | $basket['delInf']['add_2'] - Delivery Address line 1 | |
| $basket['delInf']['town'] - Delivery Town or city | $basket['delInf']['town'] - Delivery Town or city | |
| $basket['delInf']['county'] - Delivery County or state | $basket['delInf']['county'] - Delivery County or state | |
| $basket['delInf']['postcode'] - Delivery Post/Zip Code | $basket['delInf']['postcode'] - Delivery Post/Zip Code | |
| $basket['delInf']['country'] - Delivery country Id we can look up the country name like this | $basket['delInf']['country'] - Delivery country Id we can look up the country name like this | |
| countryName($basket['delInf']['country']); | countryName($basket['delInf']['country']); | |
| $basket['subTotal'] - Order Subtotal (exTax and Shipping) | $basket['subTotal'] - Order Subtotal (exTax and Shipping) | |
| $basket['grandTotal'] - Basket total which has to be paid (inc Tax and Shipping). | $basket['grandTotal'] - Basket total which has to be paid (inc Tax and Shipping). | |
| $basket['tax'] - Total tax to pay | $basket['tax'] - Total tax to pay | |
| $basket['shipCost'] - Shipping price | $basket['shipCost'] - Shipping price | |
| //////////////////////////////////////////////////////// | //////////////////////////////////////////////////////// | |
| */ | */ | |
| $module = fetchDbConfig("Protx"); | $module = fetchDbConfig("Protx"); | |
| ///////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////// | |
| /////////////// START OF PROTX FUNCTIONS ///////////// | /////////////// START OF PROTX FUNCTIONS ///////////// | |
| ///////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////// | |
| // ** Base 64 Encoding function ** | // ** Base 64 Encoding function ** | |
| // PHP does it natively but just for consistency and ease of maintenance, let's declare our own function | // PHP does it natively but just for consistency and ease of maintenance, let's declare our own function | |
| function base64Encode($plain) { | function base64Encode($plain) { | |
| // Initialise output variable | // Initialise output variable | |
| $output = ""; | $output = ""; | |
| // Do encoding | // Do encoding | |
| $output = base64_encode($plain); | $output = base64_encode($plain); | |
| // Return the result | // Return the result | |
| return $output; | return $output; | |
| } | } | |
| // ** Base 64 decoding function ** | // ** Base 64 decoding function ** | |
| // PHP does it natively but just for consistency and ease of maintenance, let's declare our own function | // PHP does it natively but just for consistency and ease of maintenance, let's declare our own function | |
| function base64Decode($scrambled) { | function base64Decode($scrambled) { | |
| // Initialise output variable | // Initialise output variable | |
| $output = ""; | $output = ""; | |
| // Do encoding | // Do encoding | |
| $output = base64_decode($scrambled); | $output = base64_decode($scrambled); | |
| // Return the result | // Return the result | |
| return $output; | return $output; | |
| } | } | |
| /* The SimpleXor encryption algorithm ** | /* The SimpleXor encryption algorithm ** | |
| ** NOTE: This is a placeholder really. Future releases of VSP Form will use AES or TwoFish. Proper encryption ** | ** NOTE: This is a placeholder really. Future releases of VSP Form will use AES or TwoFish. Proper encryption ** | |
| ** This simple function and the Base64 will deter script kiddies and prevent the "View Source" type tampering ** | ** This simple function and the Base64 will deter script kiddies and prevent the "View Source" type tampering ** | |
| ** It won't stop a half decent hacker though, but the most they could do is change the amount field to something ** | ** It won't stop a half decent hacker though, but the most they could do is change the amount field to something ** | |
| ** else, so provided the vendor checks the reports and compares amounts, there is no harm done. It's still ** | ** else, so provided the vendor checks the reports and compares amounts, there is no harm done. It's still ** | |
| ** more secure than the other PSPs who don't both encrypting their forms at all */ | ** more secure than the other PSPs who don't both encrypting their forms at all */ | |
| function simpleXor($InString, $Key) { | function simpleXor($InString, $Key) { | |
| // Initialise key array | // Initialise key array | |
| $KeyList = array(); | $KeyList = array(); | |
| // Initialise out variable | // Initialise out variable | |
| $output = ""; | $output = ""; | |
| // Convert $Key into array of ASCII values | // Convert $Key into array of ASCII values | |
| for($i = 0; $i < strlen($Key); $i++){ | for($i = 0; $i < strlen($Key); $i++){ | |
| $KeyList[$i] = ord(substr($Key, $i, 1)); | $KeyList[$i] = ord(substr($Key, $i, 1)); | |
| } | } | |
| // Step through string a character at a time | // Step through string a character at a time | |
| for($i = 0; $i < strlen($InString); $i++) { | for($i = 0; $i < strlen($InString); $i++) { | |
| // Get ASCII code from string, get ASCII code from key (loop through with MOD), XOR the two, get the character from the result | // Get ASCII code from string, get ASCII code from key (loop through with MOD), XOR the two, get the character from the result | |
| // % is MOD (modulus), ^ is XOR | // % is MOD (modulus), ^ is XOR | |
| $output.= chr(ord(substr($InString, $i, 1)) ^ ($KeyList[$i % strlen($Key)])); | $output.= chr(ord(substr($InString, $i, 1)) ^ ($KeyList[$i % strlen($Key)])); | |
| } | } | |
| // Return the result | // Return the result | |
| return $output; | return $output; | |
| } | } | |
| /* The getToken function. ** | /* The getToken function. ** | |
| ** NOTE: A function of convenience that extracts the value from the "name=value&name2=value2..." VSP reply string ** | ** NOTE: A function of convenience that extracts the value from the "name=value&name2=value2..." VSP reply string ** | |
| ** Works even if one of the values is a URL containing the & or = signs. */ | ** Works even if one of the values is a URL containing the & or = signs. */ | |
| function getToken($thisString) { | function getToken($thisString) { | |
| // List the possible tokens | // List the possible tokens | |
| $Tokens = array( | $Tokens = array( | |
| "Status", | "Status", | |
| "StatusDetail", | "StatusDetail", | |
| "VendorTxCode", | "VendorTxCode", | |
| "VPSTxId", | "VPSTxId", | |
| "TxAuthNo", | "TxAuthNo", | |
| "Amount", | "Amount", | |
| "AVSCV2", | "AVSCV2", | |
| "AddressResult", | "AddressResult", | |
| "PostCodeResult", | "PostCodeResult", | |
| "CV2Result", | "CV2Result", | |
| "GiftAid", | "GiftAid", | |
| "3DSecureStatus", | "3DSecureStatus", | |
| "CAVV" ); | "CAVV" ); | |
| // Initialise arrays | // Initialise arrays | |
| $output = array(); | $output = array(); | |
| $resultArray = array(); | $resultArray = array(); | |
| // Get the next token in the sequence | // Get the next token in the sequence | |
| for ($i = count($Tokens)-1; $i >= 0 ; $i--){ | for ($i = count($Tokens)-1; $i >= 0 ; $i--){ | |
| // Find the position in the string | // Find the position in the string | |
| $start = strpos($thisString, $Tokens[$i]); | $start = strpos($thisString, $Tokens[$i]); | |
| // If it's present | // If it's present | |
| if ($start !== false){ | if ($start !== false){ | |
| // Record position and token name | // Record position and token name | |
| $resultArray[$i]->start = $start; | $resultArray[$i]->start = $start; | |
| $resultArray[$i]->token = $Tokens[$i]; | $resultArray[$i]->token = $Tokens[$i]; | |
| } | } | |
| } | } | |
| // Sort in order of position | // Sort in order of position | |
| sort($resultArray); | sort($resultArray); | |
| // Go through the result array, getting the token values | // Go through the result array, getting the token values | |
| for ($i = 0; $i<count($resultArray); $i++){ | for ($i = 0; $i<count($resultArray); $i++){ | |
| // Get the start point of the value | // Get the start point of the value | |
| $valueStart = $resultArray[$i]->start + strlen($resultArray[$i]->token) + 1; | $valueStart = $resultArray[$i]->start + strlen($resultArray[$i]->token) + 1; | |
| // Get the length of the value | // Get the length of the value | |
| if ($i==(count($resultArray)-1)) { | if ($i==(count($resultArray)-1)) { | |
| $output[$resultArray[$i]->token] = substr($thisString, $valueStart); | $output[$resultArray[$i]->token] = substr($thisString, $valueStart); | |
| } else { | } else { | |
| $valueLength = $resultArray[$i+1]->start - $resultArray[$i]->start - strlen($resultArray[$i]->token) - 2; | $valueLength = $resultArray[$i+1]->start - $resultArray[$i]->start - strlen($resultArray[$i]->token) - 2; | |
| $output[$resultArray[$i]->token] = substr($thisString, $valueStart, $valueLength); | $output[$resultArray[$i]->token] = substr($thisString, $valueStart, $valueLength); | |
| } | } | |
| } | } | |
| // Return the ouput array | // Return the ouput array | |
| return $output; | return $output; | |
| } | } | |
| // Randomise based on time | // Randomise based on time | |
| function randomise() { | function randomise() { | |
| list($usec, $sec) = explode(' ', microtime()); | list($usec, $sec) = explode(' ', microtime()); | |
| return (float) $sec + ((float) $usec * 100000); | return (float) $sec + ((float) $usec * 100000); | |
| } | } | |
| ///////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////// | |
| /////////////// END OF PROTX FUNCTIONS /////////////// | /////////////// END OF PROTX FUNCTIONS /////////////// | |
| ///////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////// | |
| function repeatVars(){ | function repeatVars(){ | |
| return FALSE; | return FALSE; | |
| } | } | |
| function fixedVars(){ | function fixedVars(){ | |
| global $module, $basket, $ccUserData, $cart_order_id, $config, $GLOBALS; | global $module, $basket, $ccUserData, $cart_order_id, $config, $GLOBALS; | |
| -+ | if(!empty($basket['delInf']['add_2'])){ | |
| $delAdd = $basket['delInf']['add_1'].", ".$basket['delInf']['add_1'].", ".$basket['delInf']['town'].", ".$basket['delInf']['county'].", ".countryName($basket['delInf']['country']); | ||
| } else { | ||
| $delAdd = $basket['delInf']['add_1'].", ".$basket['delInf']['town'].", ".$basket['delInf']['county'].", ".countryName($basket['delInf']['country']); | ||
| } | ||
| if(!empty($ccUserData[0]['add_2'])){ | ||
| $invAdd = $ccUserData[0]['add_1'].", ".$ccUserData[0]['add_2'].", ".$ccUserData[0]['town'].", ".$ccUserData[0]['county'].", ".countryName($ccUserData[0]['country']); | ||
| } else { | ||
| $invAdd = $ccUserData[0]['add_1'].", ".$ccUserData[0]['town'].", ".$ccUserData[0]['county'].", ".countryName($ccUserData[0]['country']); | ||
| } | ||
| $VendorTxCode = 'CC3'.(rand(0,32000)*rand(0,32000)); | = | $VendorTxCode = 'CC3'.(rand(0,32000)*rand(0,32000)); |
| <> | ||
| // Protocol 2.23 | ||
| $cryptVars = | = | $cryptVars = |
| "VendorTxCode=".$VendorTxCode | "VendorTxCode=".$VendorTxCode | |
| ."&Amount=".$basket['grandTotal'] | ."&Amount=".$basket['grandTotal'] | |
| ."&Currency=".$config['defaultCurrency'] | ."&Currency=".$config['defaultCurrency'] | |
| ."&Description=Cart-".$cart_order_id | <> | ."&Description=Cart - ".$cart_order_id |
| ."&CustomerEmail=".$ccUserData[0]['email'] | = | ."&CustomerEmail=".$ccUserData[0]['email'] |
| ."&CustomerName=".$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName'] | <> | ."&CustomerName=".$ccUserData[0]['title']." ".$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName'] |
| ."&VendorEmail=".$config['masterEmail'] | ."&VendorEmail=".$config['masterEmail'] ."&DeliveryAddress=".$delAdd | |
| ."&DeliveryPostCode=".$basket['delInf']['postcode'] | ||
| ."&BillingAddress=".$invAdd | ||
| ."&BillingPostCode=".$ccUserData[0]['postcode'] | ||
| ."&ContactNumber=".$ccUserData[0]['phone'] | ||
| // ."&ApplyAVSCV2=0&Apply3DSecure=0&ShoppingBasket=ON" We have taken our the ShoppingBasket Variable - It seemed Protx didn't need it. | ||
| ."&ApplyAVSCV2=0&Apply3DSecure=0" | = | ."&ApplyAVSCV2=0&Apply3DSecure=0" |
| +- | ||
| ."&SuccessURL=".$GLOBALS['storeURL']."/modules/gateway/Protx/confirmed.php?oid=".base64_encode($cart_order_id)."&amt=".base64_encode($basket['grandTotal']) | = | ."&SuccessURL=".$GLOBALS['storeURL']."/modules/gateway/Protx/confirmed.php?oid=".base64_encode($cart_order_id)."&amt=".base64_encode($basket['grandTotal']) |
| ."&FailureURL=".$GLOBALS['storeURL']."/modules/gateway/Protx/confirmed.php?f=1" | <> | ."&FailureURL=".$GLOBALS['storeURL']."/modules/gateway/Protx/confirmed.php?f=1"; |
| ; | ||
| = | ||
| ## New required fields for 2.23 | +- | |
| ."&BillingSurname=".$ccUserData[0]['lastName'] | ||
| ."&BillingFirstnames=".$ccUserData[0]['firstName'] | ||
| ."&BillingAddress1=".$ccUserData[0]['add_1'] | ||
| ."&BillingAddress2=".$ccUserData[0]['add_2'] // optional | ||
| ."&BillingCity=".$ccUserData[0]['town'] | ||
| ."&BillingCountry=".countryIso($ccUserData[0]['country']) | ||
| ."&BillingPostCode=".$ccUserData[0]['postcode'] | ||
| ."&BillingPhone=".$ccUserData[0]['phone'] // optional | ||
| ."&DeliverySurname=".$basket['delInf']['firstName'] | ||
| ."&DeliveryFirstnames=".$basket['delInf']['lastName'] | ||
| ."&DeliveryAddress1=".$basket['delInf']['add_1'] | ||
| ."&DeliveryAddress2=".$basket['delInf']['add_2'] // optinal | ||
| ."&DeliveryCity=".$basket['delInf']['add_1'] | ||
| ."&DeliveryPostCode=".$basket['delInf']['postcode'] | ||
| ."&DeliveryCountry=".countryIso($basket['delInf']['country']) | ||
| ."&DeliveryPhone=".$basket['delInf']['phone'] // optional | ||
| ."&Basket=" // optional | ||
| ."&AllowGiftAid=0" // optional | ||
| ."&SendEMail=1" | ||
| ."&EMailMessage=" // optional | ||
| ."&Refferid={32839EA8-8935-49A4-95FB-369E755B632C}"; | ||
| $encrypted = base64Encode(SimpleXor($cryptVars,$module['passphrase'])); | = | $encrypted = base64Encode(SimpleXor($cryptVars,$module['passphrase'])); |
| $hiddenVars = "<input type='hidden' name='VendorTxCode' value='".$VendorTxCode."' /> | $hiddenVars = "<input type='hidden' name='VendorTxCode' value='".$VendorTxCode."' /> | |
| <input type='hidden' name='VPSProtocol' value='2.23' /> | <> | <input type='hidden' name='VPSProtocol' value='2.22' /> |
| <input type='hidden' name='TxType' value='PAYMENT' /> | = | <input type='hidden' name='TxType' value='PAYMENT' /> |
| <input type='hidden' name='Vendor' value='".$module['acNo']."' /> | <input type='hidden' name='Vendor' value='".$module['acNo']."' /> | |
| <input type='hidden' name='Crypt' value='".$encrypted."' />"; | <input type='hidden' name='Crypt' value='".$encrypted."' />"; | |
| return $hiddenVars; | return $hiddenVars; | |
| } | } | |
| function successFirst(){ | function successFirst(){ | |
| if(isset($_GET['crypt']) && isset($_GET['oid'])){ | if(isset($_GET['crypt']) && isset($_GET['oid'])){ | |
| return TRUE; | return TRUE; | |
| } else { | } else { | |
| return FALSE; | return FALSE; | |
| } | } | |
| } | } | |
| function success(){ | function success(){ | |
| global $basket; | global $basket; | |
| if($_GET['f']==1){ | if($_GET['f']==1){ | |
| return FALSE; | return FALSE; | |
| } else { | } else { | |
| return TRUE; | return TRUE; | |
| } | } | |
| } | } | |
| /////////////////////////// | /////////////////////////// | |
| // Other Vars | // Other Vars | |
| //////// | //////// | |
| if($module['gate'] == "sim") { | if($module['gate'] == "sim") { | |
| $formAction = "https://test.sagepay.com/Simulator/VSPFormGateway.asp"; | <> | $formAction = "https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp"; |
| = | ||
| } elseif($module['gate'] == "test") { | } elseif($module['gate'] == "test") { | |
| $formAction ="https://test.sagepay.com/gateway/service/vspform-register.vsp"; | <> | $formAction ="https://ukvpstest.protx.com/vps2form/submit.asp"; |
| = | ||
| } elseif($module['gate'] == "live"){ | } elseif($module['gate'] == "live"){ | |
| $formAction ="https://live.sagepay.com/gateway/service/vspform-register.vsp"; | <> | $formAction ="https://ukvps.protx.com/vps2form/submit.asp"; |
| = | ||
| } | } | |
| $formMethod = "post"; | $formMethod = "post"; | |
| $formTarget = "_self"; | $formTarget = "_self"; | |
| $transfer = "auto"; | $transfer = "auto"; | |
| $stateUpdate = TRUE; | $stateUpdate = TRUE; | |
| ?> | ?> |
| <?php | = | <?php |
| /* | /* | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | CubeCart v3 | | CubeCart v3 | |
| | ======================================== | | ======================================== | |
| | by Alistair Brookbanks | | by Alistair Brookbanks | |
| | CubeCart is a Trade Mark of CubeCart Limited | | CubeCart is a Trade Mark of CubeCart Limited | |
| | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | |
| | CubeCart Limited, | | CubeCart Limited, | |
| | 5 Bridge Street, | | 5 Bridge Street, | |
| | Bishops Stortford, | | Bishops Stortford, | |
| | HERTFORDSHIRE. | | HERTFORDSHIRE. | |
| | CM23 2JU | | CM23 2JU | |
| | UNITED KINGDOM | | UNITED KINGDOM | |
| | http://www.CubeCart.com | | http://www.CubeCart.com | |
| | UK Private Limited Company No. 5323904 | | UK Private Limited Company No. 5323904 | |
| | ======================================== | | ======================================== | |
| | Web: http://www.cubecart.com | | Web: http://www.cubecart.com | |
| | Date: Tuesday, 17th July 2007 | | Date: Tuesday, 17th July 2007 | |
| | Email: sales (at) cubecart (dot) com | | Email: sales (at) cubecart (dot) com | |
| | License Type: CubeCart is NOT Open Source Software and Limitations Apply | | License Type: CubeCart is NOT Open Source Software and Limitations Apply | |
| | Licence Info: http://www.cubecart.com/site/faq/license.php | | Licence Info: http://www.cubecart.com/site/faq/license.php | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | transfer.php | | transfer.php | |
| | ======================================== | | ======================================== | |
| | Core functions for the Linkpoint Gateway | | Core functions for the Linkpoint Gateway | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| */ | */ | |
| /* | /* | |
| ////////////////////////// | ////////////////////////// | |
| // LINKPOINT GATEWAY | // LINKPOINT GATEWAY | |
| ////////////////////////// | ////////////////////////// | |
| // L@@K AT ALL THE LOVELY | // L@@K AT ALL THE LOVELY | |
| // VARIABLES WE HAVE TO | // VARIABLES WE HAVE TO | |
| // PLAY WITH!! | // PLAY WITH!! | |
| ////// | ////// | |
| ////////////////////////// | ////////////////////////// | |
| // IN THE REPEATED REGION | // IN THE REPEATED REGION | |
| ////// | ////// | |
| $orderInv['productId'] - product id as an integer | $orderInv['productId'] - product id as an integer | |
| $orderInv['name'] - product name as a varchar | $orderInv['name'] - product name as a varchar | |
| $orderInv['price'] - price of each product (inc options) | $orderInv['price'] - price of each product (inc options) | |
| $orderInv['quantity'] - quantity of products as an integer | $orderInv['quantity'] - quantity of products as an integer | |
| $orderInv['product_options'] - products attributes as test | $orderInv['product_options'] - products attributes as test | |
| $orderInv['productCode'] - product code as a varchar | $orderInv['productCode'] - product code as a varchar | |
| $i - This is the current incremented integer starting at 0 | $i - This is the current incremented integer starting at 0 | |
| ///////////////////////// | ///////////////////////// | |
| // FIXED VARS | // FIXED VARS | |
| /////// | /////// | |
| $cart_order_id - cart order id as a varchar | $cart_order_id - cart order id as a varchar | |
| $ccUserData[0]['email'] - Customers email address | $ccUserData[0]['email'] - Customers email address | |
| $ccUserData[0]['title'] - Customers title (Mr Miss etc...) | $ccUserData[0]['title'] - Customers title (Mr Miss etc...) | |
| $ccUserData[0]['firstName'] - Customers first name | $ccUserData[0]['firstName'] - Customers first name | |
| $ccUserData[0]['lastName'] - Customers last name | $ccUserData[0]['lastName'] - Customers last name | |
| $ccUserData[0]['add_1'] - Invoice Address line 1 | $ccUserData[0]['add_1'] - Invoice Address line 1 | |
| $ccUserData[0]['add_2'] - Invoice Address line 1 | $ccUserData[0]['add_2'] - Invoice Address line 1 | |
| $ccUserData[0]['town'] - Invoice Town or city | $ccUserData[0]['town'] - Invoice Town or city | |
| $ccUserData[0]['county'] - Invoice County or state | $ccUserData[0]['county'] - Invoice County or state | |
| $ccUserData[0]['postcode'] - Invoice Post/Zip Code | $ccUserData[0]['postcode'] - Invoice Post/Zip Code | |
| $ccUserData[0]['country'] - Invoice country Id we can look up the country name like this | $ccUserData[0]['country'] - Invoice country Id we can look up the country name like this | |
| countryName($ccUserData[0]['country']); | countryName($ccUserData[0]['country']); | |
| $ccUserData[0]['phone'] - Contact phone no | $ccUserData[0]['phone'] - Contact phone no | |
| $ccUserData[0]['mobile'] - Mobile/Cell phone number | $ccUserData[0]['mobile'] - Mobile/Cell phone number | |
| $basket['delInf']['title'] - Delivery title (Mr Miss etc...) | $basket['delInf']['title'] - Delivery title (Mr Miss etc...) | |
| $basket['delInf']['firstName'] - Delivery customers first name | $basket['delInf']['firstName'] - Delivery customers first name | |
| $basket['delInf']['lastName'] - Delivery customers last name | $basket['delInf']['lastName'] - Delivery customers last name | |
| $basket['delInf']['add_1'] - Delivery Address line 1 | $basket['delInf']['add_1'] - Delivery Address line 1 | |
| $basket['delInf']['add_2'] - Delivery Address line 1 | $basket['delInf']['add_2'] - Delivery Address line 1 | |
| $basket['delInf']['town'] - Delivery Town or city | $basket['delInf']['town'] - Delivery Town or city | |
| $basket['delInf']['county'] - Delivery County or state | $basket['delInf']['county'] - Delivery County or state | |
| $basket['delInf']['postcode'] - Delivery Post/Zip Code | $basket['delInf']['postcode'] - Delivery Post/Zip Code | |
| $basket['delInf']['country'] - Delivery country Id we can look up the country name like this | $basket['delInf']['country'] - Delivery country Id we can look up the country name like this | |
| countryName($basket['delInf']['country']); | countryName($basket['delInf']['country']); | |
| $basket['subTotal'] - Order Subtotal (exTax and Shipping) | $basket['subTotal'] - Order Subtotal (exTax and Shipping) | |
| $basket['grandTotal'] - Basket total which has to be paid (inc Tax and Shipping). | $basket['grandTotal'] - Basket total which has to be paid (inc Tax and Shipping). | |
| $basket['tax'] - Total tax to pay | $basket['tax'] - Total tax to pay | |
| $basket['shipCost'] - Shipping price | $basket['shipCost'] - Shipping price | |
| //////////////////////////////////////////////////////// | //////////////////////////////////////////////////////// | |
| */ | */ | |
| $module = fetchDbConfig("LinkPoint"); | $module = fetchDbConfig("LinkPoint"); | |
| function repeatVars(){ | function repeatVars(){ | |
| return FALSE; | return FALSE; | |
| } | } | |
| function fixedVars(){ | function fixedVars(){ | |
| global $module, $basket, $ccUserData, $cart_order_id, $config; | global $module, $basket, $ccUserData, $cart_order_id, $config; | |
| $hiddenVars = "<input type='hidden' name='mode' value='payonly' /> | $hiddenVars = "<input type='hidden' name='mode' value='payonly' /> | |
| <input type='hidden' name='chargetotal' value='".$basket['grandTotal']."' /> | <input type='hidden' name='chargetotal' value='".$basket['grandTotal']."' /> | |
| <input type='hidden' name='storename' value='".$module['acNo']."' /> | <input type='hidden' name='storename' value='".$module['acNo']."' /> | |
| <input type='hidden' name='baddr1' value='".$ccUserData[0]['add_1']." ".$ccUserData[0]['add_2']."' /> | <input type='hidden' name='baddr1' value='".$ccUserData[0]['add_1']." ".$ccUserData[0]['add_2']."' /> | |
| <input type='hidden' name='bzip' value='".$ccUserData[0]['postcode']."' /> | <input type='hidden' name='bzip' value='".$ccUserData[0]['postcode']."' /> | |
| <input type='hidden' name='txnorg' value='eci' /> | <input type='hidden' name='txnorg' value='eci' /> | |
| <input type='hidden' name='txntype' value='sale' /> | <input type='hidden' name='txntype' value='sale' /> | |
| <input type='hidden' name='authenticateTransaction' value='false' /> | <input type='hidden' name='authenticateTransaction' value='false' /> | |
| <input type='hidden' name='bname' value='".$ccUserData[0]['title']." ".$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName']."' /> | <input type='hidden' name='bname' value='".$ccUserData[0]['title']." ".$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName']."' /> | |
| <input type='hidden' name='bcity' value='".$ccUserData[0]['town']."' /> | <input type='hidden' name='bcity' value='".$ccUserData[0]['town']."' /> | |
| <input type='hidden' name='bcountry' value='".countryIso($ccUserData[0]['country'])."' /> | <> | <input type='hidden' name='bcountry' value='".countryName($ccUserData[0]['country'])."' /> |
| <input type='hidden' name='bstate' value='".$ccUserData[0]['county']."' /> | = | <input type='hidden' name='bstate' value='".$ccUserData[0]['county']."' /> |
| <input type='hidden' name='email' value='".$ccUserData[0]['email']."' /> | <input type='hidden' name='email' value='".$ccUserData[0]['email']."' /> | |
| <input type='hidden' name='responseSuccessURL' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&oid=".base64_encode($cart_order_id)."' /> | <input type='hidden' name='responseSuccessURL' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&oid=".base64_encode($cart_order_id)."' /> | |
| <input type='hidden' name='responseFailURL' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&f=1&oid=".base64_encode($cart_order_id)."' /> | <input type='hidden' name='responseFailURL' value='".$GLOBALS['storeURL']."/confirmed.php?act=conf&f=1&oid=".base64_encode($cart_order_id)."' /> | |
| <input type='hidden' name='oid' value='".$cart_order_id."' /> | <input type='hidden' name='oid' value='".$cart_order_id."' /> | |
| <input type='hidden' name='comments' value='".$basket['customer_comments']."' /> | <input type='hidden' name='comments' value='".$basket['customer_comments']."' /> | |
| <input type='hidden' name='userid' value='".$ccUserData[0]['customer_id']."' /> | <input type='hidden' name='userid' value='".$ccUserData[0]['customer_id']."' /> | |
| <input type='hidden' name='phone' value='".$ccUserData[0]['phone']."' />"; | <input type='hidden' name='phone' value='".$ccUserData[0]['phone']."' />"; | |
| return $hiddenVars; | return $hiddenVars; | |
| } | } | |
| function success(){ | function success(){ | |
| global $basket; | global $basket; | |
| if($_GET['f']==1) { | <> | |
| return false; | ||
| } elseif((base64_decode($_GET['oid']) == $basket['cart_order_id'])) { | if( (base64_decode($_GET['oid']) == $basket['cart_order_id'])) { | |
| return true; | return TRUE; | |
| } else { | } else{ | |
| return false; | return FALSE; | |
| } | } | |
| = | ||
| } | } | |
| /////////////////////////// | /////////////////////////// | |
| // Other Vars | // Other Vars | |
| //////// | //////// | |
| +- | ||
| if($module['testMode']=="Y"){ | = | if($module['testMode']=="Y"){ |
| $formAction = "https://www.staging.linkpointcentral.com/lpc/servlet/lppay"; | <> | $formAction = "https://www.linkpointcentral.com/lpc/servlet/lppay"; |
| = | ||
| } else { | } else { | |
| $formAction = "https://www.linkpointcentral.com/lpc/servlet/lppay"; | $formAction = "https://www.linkpointcentral.com/lpc/servlet/lppay"; | |
| } | } | |
| $formMethod = "post"; | $formMethod = "post"; | |
| $formTarget = "_self"; | $formTarget = "_self"; | |
| $transfer = "auto"; | $transfer = "auto"; | |
| $stateUpdate = TRUE; | $stateUpdate = TRUE; | |
| ?> | ?> |
| <?php | = | <?php |
| /* | /* | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | CubeCart v3.0.18 | | CubeCart v3.0.18 | |
| | ======================================== | | ======================================== | |
| | by Alistair Brookbanks | | by Alistair Brookbanks | |
| | CubeCart is a Trade Mark of CubeCart Limited | | CubeCart is a Trade Mark of CubeCart Limited | |
| | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | | Copyright CubeCart Limited 2005 - 2014. All rights reserved. | |
| | CubeCart Limited, | | CubeCart Limited, | |
| | 5 Bridge Street, | | 5 Bridge Street, | |
| | Bishops Stortford, | | Bishops Stortford, | |
| | HERTFORDSHIRE. | | HERTFORDSHIRE. | |
| | CM23 2JU | | CM23 2JU | |
| | UNITED KINGDOM | | UNITED KINGDOM | |
| | http://www.CubeCart.com | | http://www.CubeCart.com | |
| | UK Private Limited Company No. 5323904 | | UK Private Limited Company No. 5323904 | |
| | ======================================== | | ======================================== | |
| | Web: http://www.cubecart.com | | Web: http://www.cubecart.com | |
| | Date: Tuesday, 17th July 2007 | | Date: Tuesday, 17th July 2007 | |
| | Email: sales (at) cubecart (dot) com | | Email: sales (at) cubecart (dot) com | |
| | License Type: CubeCart is NOT Open Source Software and Limitations Apply | | License Type: CubeCart is NOT Open Source Software and Limitations Apply | |
| | Licence Info: http://www.cubecart.com/site/faq/license.php | | Licence Info: http://www.cubecart.com/site/faq/license.php | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| | index.php | | index.php | |
| | ======================================== | | ======================================== | |
| | Add/Edit/Delete Products | | Add/Edit/Delete Products | |
| +-------------------------------------------------------------------------- | +-------------------------------------------------------------------------- | |
| */ | */ | |
| include("../../includes/ini.inc.php"); | include("../../includes/ini.inc.php"); | |
| include("../../includes/global.inc.php"); | include("../../includes/global.inc.php"); | |
| require_once("../../classes/db.inc.php"); | require_once("../../classes/db.inc.php"); | |
| $db = new db(); | $db = new db(); | |
| include_once("../../includes/functions.inc.php"); | include_once("../../includes/functions.inc.php"); | |
| $config = fetchDbConfig("config"); | $config = fetchDbConfig("config"); | |
| include_once("../../language/".$config['defaultLang']."/lang.inc.php"); | include_once("../../language/".$config['defaultLang']."/lang.inc.php"); | |
| $enableSSl = 1; | $enableSSl = 1; | |
| include("../../includes/sslSwitch.inc.php"); | include("../../includes/sslSwitch.inc.php"); | |
| include("../includes/auth.inc.php"); | include("../includes/auth.inc.php"); | |
| include("../includes/rte/fckeditor.php"); | include("../includes/rte/fckeditor.php"); | |
| include("../../classes/gd.inc.php"); | include("../../classes/gd.inc.php"); | |
| include("../../includes/currencyVars.inc.php"); | include("../../includes/currencyVars.inc.php"); | |
| if(permission("products","read")==FALSE){ | if(permission("products","read")==FALSE){ | |
| header("Location: ".$GLOBALS['rootRel']."admin/401.php"); | header("Location: ".$GLOBALS['rootRel']."admin/401.php"); | |
| exit; | exit; | |
| } | } | |
| $productsPerPage = 25; | $productsPerPage = 25; | |
| if(isset($_GET['action']) && $_GET['action']=="gbase"){ | if(isset($_GET['action']) && $_GET['action']=="gbase"){ | |
| $db = new db(); | $db = new db(); | |
| $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY name ASC"; | $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY name ASC"; | |
| $results = $db->select($query); | $results = $db->select($query); | |
| if($results==TRUE) { | if($results==TRUE) { | |
| $googleBaseContent = "id\tproduct_url\tname\tdescription\timage_url\tprice\tcondition\r\n"; | <> | $googleBaseContent = "id\tproduct_url\tname\tdescription\timage_url\tprice\r\n"; |
| = | ||
| for($i=0; $i<count($results); $i++){ | for($i=0; $i<count($results); $i++){ | |
| $salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']); | $salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']); | |
| if($salePrice > 0){ | if($salePrice > 0){ | |
| $price = $salePrice; | $price = $salePrice; | |
| } else { | } else { | |
| $price = $results[$i]['price']; | $price = $results[$i]['price']; | |
| } | } | |
| $name = str_replace(array(" ","\t","\r","\n","\0","\x0B"," | $name = str_replace(array(" ","\t","\r","\n","\0","\x0B"," | |
| "),"",strip_tags($results[$i]['name'])); | "),"",strip_tags($results[$i]['name'])); | |
| $name = str_replace(" ","",$name); | $name = str_replace(" ","",$name); | |
| $desc = str_replace(array(" ","\t","\r","\n","\0","\x0B"," | $desc = str_replace(array(" ","\t","\r","\n","\0","\x0B"," | |
| "),"",strip_tags($results[$i]['description'])); | "),"",strip_tags($results[$i]['description'])); | |
| $desc = str_replace(" ","",$desc); | $desc = str_replace(" ","",$desc); | |
| $googleBaseContent .= | $googleBaseContent .= | |
| $results[$i]['productId']."\t".$glob['storeURL']."/index.php?act=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc; | $results[$i]['productId']."\t".$glob['storeURL']."/index.php?act=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc; | |
| if($results[$i]['image']){ | if($results[$i]['image']){ | |
| $googleBaseContent .= "\t".$glob['storeURL']."/images/uploads/".$results[$i]['image']; | $googleBaseContent .= "\t".$glob['storeURL']."/images/uploads/".$results[$i]['image']; | |
| } else { | } else { | |
| $googleBaseContent .= "\t".$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif"; | $googleBaseContent .= "\t".$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif"; | |
| } | } | |
| $googleBaseContent .= "\t".$price."\tnew\r\n"; | <> | $googleBaseContent .= "\t".$price."\r\n"; |
| = | ||
| } | } | |
| $filename = "GoogleBaseFeed_"; | $filename = "GoogleBaseFeed_"; | |
| $contentLength = strlen($googleBaseContent); | $contentLength = strlen($googleBaseContent); | |
| $content = $googleBaseContent; | $content = $googleBaseContent; | |
| $filename .= date("dMy").".txt"; | $filename .= date("dMy").".txt"; | |
| header('Pragma: private'); | header('Pragma: private'); | |
| header('Cache-control: private, must-revalidate'); | header('Cache-control: private, must-revalidate'); | |
| header("Content-Disposition: attachment; filename=".$filename); | header("Content-Disposition: attachment; filename=".$filename); | |
| header("Content-type: text/plain"); | header("Content-type: text/plain"); | |
| header("Content-type: application/octet-stream"); | header("Content-type: application/octet-stream"); | |
| header("Content-length: ".$contentLength); | header("Content-length: ".$contentLength); | |
| header("Content-Transfer-Encoding: binary"); | header("Content-Transfer-Encoding: binary"); | |
| echo $content; | echo $content; | |
| exit; | exit; | |
| } | } | |
| } elseif(isset($_GET['delete']) && $_GET["delete"]>0){ | } elseif(isset($_GET['delete']) && $_GET["delete"]>0){ | |
| // delete product | // delete product | |
| $where = "productId=".$db->mySQLSafe($_GET["delete"]); | $where = "productId=".$db->mySQLSafe($_GET["delete"]); | |
| $delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where); | $delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where); | |
| // set categories -1 | // set categories -1 | |
| $cats = $db->select("SELECT cat_id FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$db->mySQLSafe($_GET["delete"])); | $cats = $db->select("SELECT cat_id FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$db->mySQLSafe($_GET["delete"])); | |
| if($cats==TRUE){ | if($cats==TRUE){ | |
| for($i=0;$i<count($cats);$i++){ | for($i=0;$i<count($cats);$i++){ | |
| $db->categoryNos($cats[$i]['cat_id'], "-"); | $db->categoryNos($cats[$i]['cat_id'], "-"); | |
| } | } | |
| } | } | |
| // delete category index | // delete category index | |
| $where = "productId=".$db->mySQLSafe($_GET["delete"]); | $where = "productId=".$db->mySQLSafe($_GET["delete"]); | |
| $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | |
| unset($record); | unset($record); | |
| // delete product options | // delete product options | |
| $record['product'] = $db->mySQLSafe($_GET["delete"]); | $record['product'] = $db->mySQLSafe($_GET["delete"]); | |
| $where = "product=".$db->mySQLSafe($_GET["delete"]); | $where = "product=".$db->mySQLSafe($_GET["delete"]); | |
| $deleteOps = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); | $deleteOps = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); | |
| unset($record); | unset($record); | |
| if($delete == TRUE){ | if($delete == TRUE){ | |
| $msg = "<p class='infoText'>".$lang['admin']['products']['delete_success']."</p>"; | $msg = "<p class='infoText'>".$lang['admin']['products']['delete_success']."</p>"; | |
| } else { | } else { | |
| $msg = "<p class='warnText'>".$lang['admin']['products']['delete_fail']."</p>"; | $msg = "<p class='warnText'>".$lang['admin']['products']['delete_fail']."</p>"; | |
| } | } | |
| } elseif(isset($_POST['productId'])) { | } elseif(isset($_POST['productId'])) { | |
| // generate product code | // generate product code | |
| if(empty($_POST['productCode'])){ | if(empty($_POST['productCode'])){ | |
| $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", | $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", | |
| "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", | "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", | |
| "4","5","6","7","8","9","0"); | "4","5","6","7","8","9","0"); | |
| $max_chars = count($chars) - 1; | $max_chars = count($chars) - 1; | |
| srand((double)microtime()*1000000); | srand((double)microtime()*1000000); | |
| for($i = 0; $i < 5; $i++){ | for($i = 0; $i < 5; $i++){ | |
| $randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; | $randChars = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; | |
| } | } | |
| $record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']); | $record["productCode"] = $db->mySQLSafe(strtoupper(substr($_POST['name'],0,3)).$randChars.$_POST['cat_id']); | |
| } else { | } else { | |
| $record["productCode"] = $db->mySQLSafe($_POST['productCode']); | $record["productCode"] = $db->mySQLSafe($_POST['productCode']); | |
| } | } | |
| $record["name"] = $db->mySQLSafe($_POST['name']); | $record["name"] = $db->mySQLSafe($_POST['name']); | |
| $record["cat_id"] = $db->mySQLSafe($_POST['cat_id']); | $record["cat_id"] = $db->mySQLSafe($_POST['cat_id']); | |
| $record["description"] = $db->mySQLSafe($_POST['FCKeditor']); | $record["description"] = $db->mySQLSafe($_POST['FCKeditor']); | |
| $record["image"] = $db->mySQLSafe($_POST['imageName']); | $record["image"] = $db->mySQLSafe($_POST['imageName']); | |
| $record["price"] = $db->mySQLSafe($_POST['price']); | $record["price"] = $db->mySQLSafe($_POST['price']); | |
| $record["sale_price"] = $db->mySQLSafe($_POST['sale_price']); | $record["sale_price"] = $db->mySQLSafe($_POST['sale_price']); | |
| $record["stock_level"] = $db->mySQLSafe($_POST['stock_level']); | $record["stock_level"] = $db->mySQLSafe($_POST['stock_level']); | |
| $record["useStockLevel"] = $db->mySQLSafe($_POST['useStockLevel']); | $record["useStockLevel"] = $db->mySQLSafe($_POST['useStockLevel']); | |
| $record["digital"] = $db->mySQLSafe($_POST['digital']); | $record["digital"] = $db->mySQLSafe($_POST['digital']); | |
| $record["digitalDir"] = $db->mySQLSafe($_POST['digitalDir']); | $record["digitalDir"] = $db->mySQLSafe($_POST['digitalDir']); | |
| $record["prodWeight"] = $db->mySQLSafe($_POST['prodWeight']); | $record["prodWeight"] = $db->mySQLSafe($_POST['prodWeight']); | |
| $record["taxType"] = $db->mySQLSafe($_POST['taxType']); | $record["taxType"] = $db->mySQLSafe($_POST['taxType']); | |
| $record["showFeatured"] = $db->mySQLSafe($_POST['showFeatured']); | $record["showFeatured"] = $db->mySQLSafe($_POST['showFeatured']); | |
| // if image is a JPG check thumbnail doesn't exist and if not make one | // if image is a JPG check thumbnail doesn't exist and if not make one | |
| $imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName'])); | $imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName'])); | |
| if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){ | if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){ | |
| if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'])){ | if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'])){ | |
| @chmod($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'], 0775); | @chmod($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName'], 0775); | |
| unlink($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); | unlink($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); | |
| } | } | |
| $thumb=new thumbnail($GLOBALS['rootDir']."/images/uploads/".$_POST['imageName']); | $thumb=new thumbnail($GLOBALS['rootDir']."/images/uploads/".$_POST['imageName']); | |
| $thumb->size_auto($config['gdthumbSize']); | $thumb->size_auto($config['gdthumbSize']); | |
| $thumb->jpeg_quality($config['gdquality']); | $thumb->jpeg_quality($config['gdquality']); | |
| $thumb->save($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); | $thumb->save($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$_POST['imageName']); | |
| } | } | |
| if(isset($_POST['productId']) && $_POST['productId']>0) { | if(isset($_POST['productId']) && $_POST['productId']>0) { | |
| $where = "productId=".$db->mySQLSafe($_POST['productId']); | $where = "productId=".$db->mySQLSafe($_POST['productId']); | |
| $update = $db->update($glob['dbprefix']."CubeCart_inventory", $record, $where); | $update = $db->update($glob['dbprefix']."CubeCart_inventory", $record, $where); | |
| unset($record, $where); | unset($record, $where); | |
| // update category count | // update category count | |
| if($_POST['oldCatId']!==$_POST['cat_id']){ | if($_POST['oldCatId']!==$_POST['cat_id']){ | |
| // set old category -1 IF IT WAS IN THERE BEFORE | // set old category -1 IF IT WAS IN THERE BEFORE | |
| $numOldCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['oldCatId'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); | $numOldCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['oldCatId'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); | |
| if($numOldCat>0){ | if($numOldCat>0){ | |
| $db->categoryNos($_POST['oldCatId'], "-"); | $db->categoryNos($_POST['oldCatId'], "-"); | |
| } | } | |
| // set new category +1 IF IT WAS NOT IN THERE BEFORE | // set new category +1 IF IT WAS NOT IN THERE BEFORE | |
| $numNewCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['cat_id'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); | $numNewCat = $db->numrows("SELECT * FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE cat_id = ".$db->mySQLSafe($_POST['cat_id'])." AND productId = ".$db->mySQLSafe($_POST['productId'])); | |
| if($numNewCat == 0) { | if($numNewCat == 0) { | |
| $db->categoryNos($_POST['cat_id'], "+"); | $db->categoryNos($_POST['cat_id'], "+"); | |
| } | } | |
| // delete old idx | // delete old idx | |
| $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['oldCatId']); | $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['oldCatId']); | |
| $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | |
| unset($record); | unset($record); | |
| // delete new index if it was added as an extra before | // delete new index if it was added as an extra before | |
| $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['cat_id']); | $where = "productId = ".$db->mySQLSafe($_POST['productId'])." AND cat_id = ".$db->mySQLSafe($_POST['cat_id']); | |
| $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | $deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where); | |
| unset($record); | unset($record); | |
| // add new idx | // add new idx | |
| $record['productId'] = $db->mySQLSafe($_POST['productId']); | $record['productId'] = $db->mySQLSafe($_POST['productId']); | |
| $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); | $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); | |
| $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); | $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); | |
| unset($record); | unset($record); | |
| } | } | |
| if($update == TRUE){ | if($update == TRUE){ | |
| $msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['update_successful']."</p>"; | $msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['update_successful']."</p>"; | |
| } else { | } else { | |
| $msg = "<p class='warnText'>".$lang['admin']['products']['update_fail']."</p>"; | $msg = "<p class='warnText'>".$lang['admin']['products']['update_fail']."</p>"; | |
| } | } | |
| } else { | } else { | |
| $insert = $db->insert($glob['dbprefix']."CubeCart_inventory", $record); | $insert = $db->insert($glob['dbprefix']."CubeCart_inventory", $record); | |
| unset($record); | unset($record); | |
| $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); | $record['cat_id'] = $db->mySQLSafe($_POST['cat_id']); | |
| $record['productId'] = $db->insertid(); | $record['productId'] = $db->insertid(); | |
| $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); | $insertIdx = $db->insert($glob['dbprefix']."CubeCart_cats_idx", $record); | |
| unset($record); | unset($record); | |
| if($insert == TRUE){ | if($insert == TRUE){ | |
| $msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['add_success']."</p>"; | $msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['products']['add_success']."</p>"; | |
| // notch up amount of products in category | // notch up amount of products in category | |
| $db->categoryNos($_POST['cat_id'], "+"); | $db->categoryNos($_POST['cat_id'], "+"); | |
| } else { | } else { | |
| $msg = "<p class='warnText'>".$lang['admin']['products']['add_fail']."</p>"; | $msg = "<p class='warnText'>".$lang['admin']['products']['add_fail']."</p>"; | |
| } | } | |
| } | } | |
| } | } | |
| if(!isset($_GET['mode'])){ | if(!isset($_GET['mode'])){ | |
| // make sql query | // make sql query | |
| if(isset($_GET['edit']) && $_GET['edit']>0){ | if(isset($_GET['edit']) && $_GET['edit']>0){ | |
| $query = sprintf("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productId = %s", $db->mySQLSafe($_GET['edit'])); | $query = sprintf("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productId = %s", $db->mySQLSafe($_GET['edit'])); | |
| } else { | } else { | |
| if(isset($_GET['orderCol']) && isset($_GET['orderDir'])){ | if(isset($_GET['orderCol']) && isset($_GET['orderDir'])){ | |
| $orderBy = $glob['dbprefix']."CubeCart_inventory.".$_GET['orderCol']." ".$_GET['orderDir']; | $orderBy = $glob['dbprefix']."CubeCart_inventory.".$_GET['orderCol']." ".$_GET['orderDir']; | |
| } else { | } else { | |
| $orderBy = $glob['dbprefix']."CubeCart_inventory.productId ASC"; | $orderBy = $glob['dbprefix']."CubeCart_inventory.productId ASC"; | |
| } | } | |
| $whereClause = ""; | $whereClause = ""; | |
| if(isset($_GET['searchStr']) && !empty($_GET['searchStr'])){ | if(isset($_GET['searchStr']) && !empty($_GET['searchStr'])){ | |
| $searchwords = split ( "[ ,]", $_GET['searchStr']); | $searchwords = split ( "[ ,]", $_GET['searchStr']); | |
| foreach($searchwords as $word){ | foreach($searchwords as $word){ | |
| $searchArray[]=$word; | $searchArray[]=$word; | |
| } | } | |
| $noKeys = count($searchArray); | $noKeys = count($searchArray); | |
| for ($i=0; $i<$noKeys;$i++) { | for ($i=0; $i<$noKeys;$i++) { | |
| $ucSearchTerm = strtoupper($searchArray[$i]); | $ucSearchTerm = strtoupper($searchArray[$i]); | |
| if(($ucSearchTerm!=="AND")AND($ucSearchTerm!=="OR")){ | if(($ucSearchTerm!=="AND")AND($ucSearchTerm!=="OR")){ | |
| $like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') OR "; | $like .= "(name LIKE '%".$searchArray[$i]."%' OR description LIKE '%".$searchArray[$i]."%' OR productCode LIKE '%".$searchArray[$i]."%') OR "; | |
| } else { | } else { | |
| $like = substr($like,0,strlen($like)-3); | $like = substr($like,0,strlen($like)-3); | |
| $like .= $ucSearchTerm; | $like .= $ucSearchTerm; | |
| } | } | |
| } | } | |
| $like = substr($like,0,strlen($like)-3); | $like = substr($like,0,strlen($like)-3); | |
| $whereClause .= "WHERE ".$like; | $whereClause .= "WHERE ".$like; | |
| } | } | |
| if(isset($_GET['category']) && $_GET['category']>0){ | if(isset($_GET['category']) && $_GET['category']>0){ | |
| if(isset($like)){ | if(isset($like)){ | |
| $whereClause .= " AND "; | $whereClause .= " AND "; | |
| } else { | } else { | |
| $whereClause .= " WHERE "; | $whereClause .= " WHERE "; | |
| } | } | |
| $whereClause .= $glob['dbprefix']."CubeCart_inventory.cat_id = ".$_GET['category']; | $whereClause .= $glob['dbprefix']."CubeCart_inventory.cat_id = ".$_GET['category']; | |
| } | } | |
| $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY ".$orderBy; | $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category on ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ".$whereClause." ORDER BY ".$orderBy; | |
| } | } | |
| // query database | // query database | |
| if(isset($_GET['page'])){ | if(isset($_GET['page'])){ | |
| $page = $_GET['page']; | $page = $_GET['page']; | |
| } else { | } else { | |
| $page = 0; | $page = 0; | |
| } | } | |
| $results = $db->select($query, $productsPerPage, $page); | $results = $db->select($query, $productsPerPage, $page); | |
| $numrows = $db->numrows($query); | $numrows = $db->numrows($query); | |
| $pagination = $db->paginate($numrows, $productsPerPage, $page, "page"); | $pagination = $db->paginate($numrows, $productsPerPage, $page, "page"); | |
| } | } | |
| $query = "SELECT cat_id, cat_name, cat_father_id FROM ".$glob['dbprefix']."CubeCart_category ORDER BY cat_id DESC"; | $query = "SELECT cat_id, cat_name, cat_father_id FROM ".$glob['dbprefix']."CubeCart_category ORDER BY cat_id DESC"; | |
| $categoryArray = $db->select($query); | $categoryArray = $db->select($query); | |
| include("../includes/header.inc.php"); | include("../includes/header.inc.php"); | |
| ?> | ?> | |
| <table width="100%" border="0" cellspacing="0" cellpadding="0"> | <table width="100%" border="0" cellspacing="0" cellpadding="0"> | |
| <tr> | <tr> | |
| <td nowrap='nowrap'><p class="pageTitle"><?php echo $lang['admin']['products']['prod_inventory'];?></p></td> | <td nowrap='nowrap'><p class="pageTitle"><?php echo $lang['admin']['products']['prod_inventory'];?></p></td> | |
| <?php if(!isset($_GET["mode"])){ ?><td align="right" valign="middle"><a <?php if(permission("products","write")==TRUE){ ?>href="?mode=new" class="txtLink" <?php } else { echo $link401; } ?>><img src="../images/buttons/new.gif" alt="" hspace="4" border="0" title="" /><?php echo $lang['admin']['add_new'];?></a></td><?php } ?> | <?php if(!isset($_GET["mode"])){ ?><td align="right" valign="middle"><a <?php if(permission("products","write")==TRUE){ ?>href="?mode=new" class="txtLink" <?php } else { echo $link401; } ?>><img src="../images/buttons/new.gif" alt="" hspace="4" border="0" title="" /><?php echo $lang['admin']['add_new'];?></a></td><?php } ?> | |
| </tr> | </tr> | |
| <tr align="right"> | <tr align="right"> | |
| <td colspan="2" nowrap='nowrap'> | <td colspan="2" nowrap='nowrap'> | |
| <a href="index.php?action=gbase"><img src="../images/googleBase.gif" alt="Download Google Base Product Feed" width="76" height="28" border="0" title="" /></a></td> | <a href="index.php?action=gbase"><img src="../images/googleBase.gif" alt="Download Google Base Product Feed" width="76" height="28" border="0" title="" /></a></td> | |
| </tr> | </tr> | |
| </table> | </table> | |
| <?php if(isset($msg)){ echo stripslashes($msg); }?> | <?php if(isset($msg)){ echo stripslashes($msg); }?> | |
| <?php | <?php | |
| if(!isset($_GET['mode']) && !isset($_GET['edit']) ){ | if(!isset($_GET['mode']) && !isset($_GET['edit']) ){ | |
| ?> | ?> | |
| <?php if($results == TRUE){ ?> | <?php if($results == TRUE){ ?> | |
| <p class="copyText"><?php echo $lang['admin']['products']['current_prods_in_db'];?></p> | <p class="copyText"><?php echo $lang['admin']['products']['current_prods_in_db'];?></p> | |
| <form name="filter" method="get" action="<?php echo $GLOBALS['rootRel'];?>admin/products/index.php"> | <form name="filter" method="get" action="<?php echo $GLOBALS['rootRel'];?>admin/products/index.php"> | |
| <p align="right" class="copyText"> | <p align="right" class="copyText"> | |
| <select name="category" class="textbox"> | <select name="category" class="textbox"> | |
| <option value="All" <?php if(isset($_GET['category']) && $_GET['category']=="All") echo "selected='selected'"; ?>><?php echo $lang['admin']['products']['all_cats'];?></option> | <option value="All" <?php if(isset($_GET['category']) && $_GET['category']=="All") echo "selected='selected'"; ?>><?php echo $lang['admin']['products']['all_cats'];?></option> | |
| <?php for ($i=0; $i<count($categoryArray); $i++){ ?> | <?php for ($i=0; $i<count($categoryArray); $i++){ ?> | |
| <option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($_GET['category']) && $categoryArray[$i]['cat_id']==$_GET['category']) echo "selected='selected'"; ?>><?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?></option> | <option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($_GET['category']) && $categoryArray[$i]['cat_id']==$_GET['category']) echo "selected='selected'"; ?>><?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?></option> | |
| <?php } ?> | <?php } ?> | |
| </select> | </select> | |
| by | by | |
| <select name="orderCol" class="textbox"> | <select name="orderCol" class="textbox"> | |
| <option value="name" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="name") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_name'];?></option> | <option value="name" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="name") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_name'];?></option> | |
| <option value="productId" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="productId") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_id'];?></option> | <option value="productId" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="productId") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_id'];?></option> | |
| <option value="productCode" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="productCode") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_code'];?></option> | <option value="productCode" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="productCode") echo "selected='selected'";?>><?php echo $lang['admin']['products']['prod_code'];?></option> | |
| <option value="cat_id" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="cat_id") echo "selected='selected'";?>><?php echo $lang['admin']['products']['master_cat2'];?></option> | <option value="cat_id" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="cat_id") echo "selected='selected'";?>><?php echo $lang['admin']['products']['master_cat2'];?></option> | |
| <option value="stock_level" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="stock_level") echo "selected='selected'";?>><?php echo $lang['admin']['products']['stock_level'];?></option> | <option value="stock_level" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="stock_level") echo "selected='selected'";?>><?php echo $lang['admin']['products']['stock_level'];?></option> | |
| <option value="price" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="price") echo "selected='selected'";?>><?php echo $lang['admin']['products']['normal_price'];?></option> | <option value="price" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="price") echo "selected='selected'";?>><?php echo $lang['admin']['products']['normal_price'];?></option> | |
| <option value="sale_price" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="sale_price") echo "selected='selected'";?>><?php echo $lang['admin']['products']['sale_price'];?></option> | <option value="sale_price" <?php if(isset($_GET['orderCol']) && $_GET['orderCol']=="sale_price") echo "selected='selected'";?>><?php echo $lang['admin']['products']['sale_price'];?></option> | |
| </select> | </select> | |
| in | in | |
| <select name="orderDir" class="textbox"> | <select name="orderDir" class="textbox"> | |
| <option value="ASC" <?php if(isset($_GET['orderDir']) && $_GET['orderDir']=="ASC") echo "selected='selected'";?>><?php echo $lang['admin']['products']['asc'];?></option> | <option value="ASC" <?php if(isset($_GET['orderDir']) && $_GET['orderDir']=="ASC") echo "selected='selected'";?>><?php echo $lang['admin']['products']['asc'];?></option> | |
| <option value="DESC" <?php if(isset($_GET['orderDir']) && $_GET['orderDir']=="DESC") echo "selected='selected'";?>><?php echo $lang['admin']['products']['desc'];?></option> | <option value="DESC" <?php if(isset($_GET['orderDir']) && $_GET['orderDir']=="DESC") echo "selected='selected'";?>><?php echo $lang['admin']['products']['desc'];?></option> | |
| </select> | </select> | |
| <?php echo $lang['admin']['products']['containing_text'];?> | <?php echo $lang['admin']['products']['containing_text'];?> | |
| <input type="text" name="searchStr" class="textbox" value="<?php if(isset($_GET['searchStr']))echo $_GET['searchStr']; ?>" /> | <input type="text" name="searchStr" class="textbox" value="<?php if(isset($_GET['searchStr']))echo $_GET['searchStr']; ?>" /> | |
| <input name="submit" type="submit" value="<?php echo $lang['admin']['products']['filter'];?>" class="submit" /> | <input name="submit" type="submit" value="<?php echo $lang['admin']['products']['filter'];?>" class="submit" /> | |
| <input name="Button" type="button" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" value="<?php echo $lang['admin']['products']['reset'];?>" class="submit" /> | <input name="Button" type="button" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" value="<?php echo $lang['admin']['products']['reset'];?>" class="submit" /> | |
| </p> | </p> | |
| </form> | </form> | |
| <?php } ?> | <?php } ?> | |
| <p class="copyText"><?php echo $pagination; ?></p> | <p class="copyText"><?php echo $pagination; ?></p> | |
| <table width="100%" border="0" cellspacing="0" cellpadding="4" class="mainTable"> | <table width="100%" border="0" cellspacing="0" cellpadding="4" class="mainTable"> | |
| <tr> | <tr> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['id'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['id'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['type'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['type'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['prod_code'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['prod_code'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['name'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['name'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['master_cat2'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['master_cat2'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['image'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['image'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['price_sale_price'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['price_sale_price'];?></td> | |
| <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['in_stock'];?></td> | <td align="center" class="tdTitle"><?php echo $lang['admin']['products']['in_stock'];?></td> | |
| <td class="tdTitle" colspan="3" align="center" width="20%"><?php echo $lang['admin']['products']['action'];?></td> | <td class="tdTitle" colspan="3" align="center" width="20%"><?php echo $lang['admin']['products']['action'];?></td> | |
| </tr> | </tr> | |
| <?php | <?php | |
| if($results == TRUE){ | if($results == TRUE){ | |
| for ($i=0; $i<count($results); $i++){ | for ($i=0; $i<count($results); $i++){ | |
| $cellColor = ""; | $cellColor = ""; | |
| $cellColor = cellColor($i); | $cellColor = cellColor($i); | |
| ?> | ?> | |
| <tr> | <tr> | |
| <td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['productId']; ?></span></td> | <td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['productId']; ?></span></td> | |
| <td align="center" class="<?php echo $cellColor; ?>"><img src="../images/productIcon<?php echo $results[$i]['digital'];?>.gif" alt="" width="16" height="16" title="" /></td> | <td align="center" class="<?php echo $cellColor; ?>"><img src="../images/productIcon<?php echo $results[$i]['digital'];?>.gif" alt="" width="16" height="16" title="" /></td> | |
| <td align="left" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['productCode']; ?></span></td> | <td align="left" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['productCode']; ?></span></td> | |
| <td align="left" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['name']; ?></span></td> | <td align="left" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['name']; ?></span></td> | |
| <td class="<?php echo $cellColor; ?>"><span class="txtDir"><?php echo getCatDir($results[$i]['cat_name'],$results[$i]['cat_father_id'], $results[$i]['cat_id']);?></span><br /> | <td class="<?php echo $cellColor; ?>"><span class="txtDir"><?php echo getCatDir($results[$i]['cat_name'],$results[$i]['cat_father_id'], $results[$i]['cat_id']);?></span><br /> | |
| <a href="javascript:;" <?php if(permission("products","edit")==TRUE){ ?>onclick="openPopUp('<?php echo $GLOBALS['rootRel']; ?>admin/products/extraCats.php?productId=<?php echo $results[$i]['productId']; ?>&cat_id=<?php echo $results[$i]['cat_id']; ?>&cat_father_id=<?php echo $results[$i]['cat_father_id']; ?>&cat_name=<?php echo urlencode($results[$i]['cat_name']); ?>&name=<?php echo urlencode($results[$i]['name']); ?>','extraCats',500,450,1);" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['manage_cats'];?></a></td> | <a href="javascript:;" <?php if(permission("products","edit")==TRUE){ ?>onclick="openPopUp('<?php echo $GLOBALS['rootRel']; ?>admin/products/extraCats.php?productId=<?php echo $results[$i]['productId']; ?>&cat_id=<?php echo $results[$i]['cat_id']; ?>&cat_father_id=<?php echo $results[$i]['cat_father_id']; ?>&cat_name=<?php echo urlencode($results[$i]['cat_name']); ?>&name=<?php echo urlencode($results[$i]['name']); ?>','extraCats',500,450,1);" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['manage_cats'];?></a></td> | |
| <td align="center" valign="middle" class="<?php echo $cellColor; ?>"> | <td align="center" valign="middle" class="<?php echo $cellColor; ?>"> | |
| <?php | <?php | |
| if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$results[$i]['image']) && !empty($results[$i]['image'])){ | if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$results[$i]['image']) && !empty($results[$i]['image'])){ | |
| $imgSize = getimagesize($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$results[$i]['image']); | $imgSize = getimagesize($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$results[$i]['image']); | |
| $imgFile = "/thumbs/thumb_".$results[$i]['image']; | $imgFile = "/thumbs/thumb_".$results[$i]['image']; | |
| } elseif(file_exists($GLOBALS['rootDir']."/images/uploads/".$results[$i]['image']) && !empty($results[$i]['image'])){ | } elseif(file_exists($GLOBALS['rootDir']."/images/uploads/".$results[$i]['image']) && !empty($results[$i]['image'])){ | |
| $imgSize = getimagesize($GLOBALS['rootDir']."/images/uploads/".$results[$i]['image']); | $imgSize = getimagesize($GLOBALS['rootDir']."/images/uploads/".$results[$i]['image']); | |
| $imgFile = $results[$i]['image']; | $imgFile = $results[$i]['image']; | |
| } | } | |
| ?> | ?> | |
| <?php if($imgFile == TRUE){ ?> | <?php if($imgFile == TRUE){ ?> | |
| <img src="<?php echo $GLOBALS['rootRel'];?>images/uploads/<?php echo $imgFile; ?>" alt="<?php echo $results[$i]['name']; ?>" title="" <?php if($imgSize['0']>49){ ?>height="50"<?php } // end if image exists ?> /> | <img src="<?php echo $GLOBALS['rootRel'];?>images/uploads/<?php echo $imgFile; ?>" alt="<?php echo $results[$i]['name']; ?>" title="" <?php if($imgSize['0']>49){ ?>height="50"<?php } // end if image exists ?> /> | |
| <div><a href="javascript:;" <?php if(permission("products","edit")==TRUE){ ?>onclick="openPopUp('<?php echo $GLOBALS['rootRel']; ?>admin/products/extraImgs.php?productId=<?php echo $results[$i]['productId']; ?>&img=<?php echo urlencode($results[$i]['image']); ?>','extraImgs',550,450,1);" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['manage_images'];?></a></div> | <div><a href="javascript:;" <?php if(permission("products","edit")==TRUE){ ?>onclick="openPopUp('<?php echo $GLOBALS['rootRel']; ?>admin/products/extraImgs.php?productId=<?php echo $results[$i]['productId']; ?>&img=<?php echo urlencode($results[$i]['image']); ?>','extraImgs',550,450,1);" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['manage_images'];?></a></div> | |
| <?php | <?php | |
| unset($imgFile); | unset($imgFile); | |
| } else { echo " "; }// end if image exists ?> | } else { echo " "; }// end if image exists ?> | |
| </td> | </td> | |
| <td align="center" class="<?php echo $cellColor; ?>"> | <td align="center" class="<?php echo $cellColor; ?>"> | |
| <span class="copyText"><?php echo priceFormat($results[$i]['price']); ?></span> | <span class="copyText"><?php echo priceFormat($results[$i]['price']); ?></span> | |
| <?php | <?php | |
| $salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']); | $salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']); | |
| if($salePrice==TRUE){?> | if($salePrice==TRUE){?> | |
| <br /> | <br /> | |
| <span class="txtRed"> | <span class="txtRed"> | |
| <?php | <?php | |
| echo priceFormat($salePrice); | echo priceFormat($salePrice); | |
| ?> | ?> | |
| </span> | </span> | |
| <?php } ?> | <?php } ?> | |
| </td> | </td> | |
| <td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php if($results[$i]['useStockLevel']==1) { echo $results[$i]['stock_level']; } else { echo "n/a"; }?></span></td> | <td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php if($results[$i]['useStockLevel']==1) { echo $results[$i]['stock_level']; } else { echo "n/a"; }?></span></td> | |
| <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","edit")==TRUE){ ?>href="?edit=<?php echo $results[$i]['productId']; ?>" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['edit'];?></a></td> | <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","edit")==TRUE){ ?>href="?edit=<?php echo $results[$i]['productId']; ?>" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['edit'];?></a></td> | |
| <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","delete")==TRUE){ ?>href="javascript:decision('<?php echo $lang['admin']['delete_q'];?>','?delete=<?php echo $results[$i]['productId']; ?>&cat_id=<?php echo $results[$i]['cat_id']; ?>');" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['delete'];?></a></td> | <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","delete")==TRUE){ ?>href="javascript:decision('<?php echo $lang['admin']['delete_q'];?>','?delete=<?php echo $results[$i]['productId']; ?>&cat_id=<?php echo $results[$i]['cat_id']; ?>');" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['delete'];?></a></td> | |
| <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","edit")==TRUE){ ?>href="languages.php?prod_master_id=<?php echo $results[$i]['productId']; ?>" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['languages'];?></a></td> | <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","edit")==TRUE){ ?>href="languages.php?prod_master_id=<?php echo $results[$i]['productId']; ?>" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['products']['languages'];?></a></td> | |
| </tr> | </tr> | |
| <?php } // end loop | <?php } // end loop | |
| } else { ?> | } else { ?> | |
| <tr> | <tr> | |
| <td colspan="6" class="tdText"><?php echo $lang['admin']['products']['no_products_exist'];?></td> | <td colspan="6" class="tdText"><?php echo $lang['admin']['products']['no_products_exist'];?></td> | |
| </tr> | </tr> | |
| <?php } ?> | <?php } ?> | |
| </table> | </table> | |
| <p class="copyText"><?php echo $pagination; ?></p> | <p class="copyText"><?php echo $pagination; ?></p> | |
| <?php | <?php | |
| } elseif(($_GET["mode"]=="new" && permission("products","write")==TRUE) || ($_GET["edit"]>0 && permission("products","edit")==TRUE)){ | } elseif(($_GET["mode"]=="new" && permission("products","write")==TRUE) || ($_GET["edit"]>0 && permission("products","edit")==TRUE)){ | |
| if(isset($_GET["edit"]) && $_GET["edit"]>0){ $modeTxt = $lang['admin']['edit']; } else { $modeTxt = $lang['admin']['add']; } | if(isset($_GET["edit"]) && $_GET["edit"]>0){ $modeTxt = $lang['admin']['edit']; } else { $modeTxt = $lang['admin']['add']; } | |
| ?> | ?> | |
| <p class="copyText"><?php echo $lang['admin']['products']['add_prod_desc'];?></p> | <p class="copyText"><?php echo $lang['admin']['products']['add_prod_desc'];?></p> | |
| <form action="<?php echo $GLOBALS['rootRel'];?>admin/products/index.php" method="post" enctype="multipart/form-data" name="form1" language="javascript"> | <form action="<?php echo $GLOBALS['rootRel'];?>admin/products/index.php" method="post" enctype="multipart/form-data" name="form1" language="javascript"> | |
| <table border="0" cellspacing="0" cellpadding="3" class="mainTable"> | <table border="0" cellspacing="0" cellpadding="3" class="mainTable"> | |
| <tr> | <tr> | |
| <td colspan="2" class="tdTitle"><?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } echo $lang['admin']['products']['product'];?> </td> | <td colspan="2" class="tdTitle"><?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } echo $lang['admin']['products']['product'];?> </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_name2'];?></strong></td> | <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_name2'];?></strong></td> | |
| <td> | <td> | |
| <input name="name" type="text" class="textbox" value="<?php if(isset($results[0]['name'])) echo validHTML($results[0]['name']); ?>" maxlength="255" /> | <input name="name" type="text" class="textbox" value="<?php if(isset($results[0]['name'])) echo validHTML($results[0]['name']); ?>" maxlength="255" /> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_stock_no'];?></strong> <br /> | <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_stock_no'];?></strong> <br /> | |
| <?php echo $lang['admin']['products']['auto_generated'];?> | <?php echo $lang['admin']['products']['auto_generated'];?> | |
| </td> | </td> | |
| <td><input name="productCode" type="text" class="textbox" value="<?php if(isset($results[0]['productCode'])) echo $results[0]['productCode']; ?>" maxlength="255" /></td> | <td><input name="productCode" type="text" class="textbox" value="<?php if(isset($results[0]['productCode'])) echo $results[0]['productCode']; ?>" maxlength="255" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td colspan="2" class="tdRichText"><span class="tdText"><strong><?php echo $lang['admin']['products']['description'];?></strong> <?php echo $lang['admin']['products']['primary_lang'];?></span> | <td colspan="2" class="tdRichText"><span class="tdText"><strong><?php echo $lang['admin']['products']['description'];?></strong> <?php echo $lang['admin']['products']['primary_lang'];?></span> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td colspan="2" class="tdRichText"> | <td colspan="2" class="tdRichText"> | |
| <?php | <?php | |
| $oFCKeditor = new FCKeditor('FCKeditor'); | $oFCKeditor = new FCKeditor('FCKeditor'); | |
| $oFCKeditor->BasePath = $GLOBALS['rootRel'].'admin/includes/rte/' ; | $oFCKeditor->BasePath = $GLOBALS['rootRel'].'admin/includes/rte/' ; | |
| if(isset($results[0]['description'])){ | if(isset($results[0]['description'])){ | |
| $oFCKeditor->Value = $results[0]['description']; | $oFCKeditor->Value = $results[0]['description']; | |
| } else { | } else { | |
| $oFCKeditor->Value = ""; | $oFCKeditor->Value = ""; | |
| } | } | |
| $oFCKeditor->Create(); | $oFCKeditor->Create(); | |
| ?> | ?> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['category'];?></strong></td> | <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['category'];?></strong></td> | |
| <td> | <td> | |
| <select name="cat_id" class="textbox"> | <select name="cat_id" class="textbox"> | |
| <?php for ($i=0; $i<count($categoryArray); $i++){ ?> | <?php for ($i=0; $i<count($categoryArray); $i++){ ?> | |
| <option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($results[0]['cat_id']) && $categoryArray[$i]['cat_id']==$results[0]['cat_id']) { echo "selected='selected'"; } ?>><?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?></option> | <option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($results[0]['cat_id']) && $categoryArray[$i]['cat_id']==$results[0]['cat_id']) { echo "selected='selected'"; } ?>><?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?></option> | |
| <?php } ?> | <?php } ?> | |
| </select> | </select> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" align="left" valign="top" class="tdText"><strong><?php echo $lang['admin']['products']['image2'];?></strong> <br /> | <td width="25%" align="left" valign="top" class="tdText"><strong><?php echo $lang['admin']['products']['image2'];?></strong> <br /> | |
| <?php echo $lang['admin']['products']['opt_and_thumbs'];?></td> | <?php echo $lang['admin']['products']['opt_and_thumbs'];?></td> | |
| <td valign="top"><div id="selectedImage"><?php if(!empty($results[0]['image'])){ ?><img src="<?php echo $GLOBALS['rootRel']."images/uploads/".$results[0]['image']; ?>" alt="<?php echo $results[0]['image']; ?>" title="" /> | <td valign="top"><div id="selectedImage"><?php if(!empty($results[0]['image'])){ ?><img src="<?php echo $GLOBALS['rootRel']."images/uploads/".$results[0]['image']; ?>" alt="<?php echo $results[0]['image']; ?>" title="" /> | |
| <br/> | <br/> | |
| <div style="padding: 3px;"><input type="button" class="submit" src="../images/remove.gif" name="remove" style="width: 200px;" value="Remove Image" onclick="addImage('','')" /></div> | <div style="padding: 3px;"><input type="button" class="submit" src="../images/remove.gif" name="remove" style="width: 200px;" value="Remove Image" onclick="addImage('','')" /></div> | |
| <?php } ?></div><div id="imageControls"><table border="0" cellspacing="0" cellpadding="3"> | <?php } ?></div><div id="imageControls"><table border="0" cellspacing="0" cellpadding="3"> | |
| <tr> | <tr> | |
| <td><input name="upload" style="width: 200px;" class="submit" type="button" id="upload" onclick="openPopUp('../filemanager/upload.php?custom=1','filemanager',450,250)" value="<?php echo $lang['admin']['products']['upload_new'];?>" /></td> | <td><input name="upload" style="width: 200px;" class="submit" type="button" id="upload" onclick="openPopUp('../filemanager/upload.php?custom=1','filemanager',450,250)" value="<?php echo $lang['admin']['products']['upload_new'];?>" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td><input name="browse" style="width: 200px;" class="submit" type="button" id="browse" onclick="openPopUp('../filemanager/browse.php?custom=1','filemanager',450,500)" value="<?php echo $lang['admin']['products']['browse_existing'];?>" /></td> | <td><input name="browse" style="width: 200px;" class="submit" type="button" id="browse" onclick="openPopUp('../filemanager/browse.php?custom=1','filemanager',450,500)" value="<?php echo $lang['admin']['products']['browse_existing'];?>" /></td> | |
| </tr> | </tr> | |
| </table> | </table> | |
| </div><input type="hidden" name="imageName" id="imageName" value="<?php if(isset($results[0]['image'])) echo $results[0]['image']; ?>" /></td> | </div><input type="hidden" name="imageName" id="imageName" value="<?php if(isset($results[0]['image'])) echo $results[0]['image']; ?>" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['normal_price2'];?></strong></td> | <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['normal_price2'];?></strong></td> | |
| <td><input name="price" value="<?php if(isset($results[0]['price'])) echo $results[0]['price']; ?>" type="text" class="textbox" size="10" /></td> | <td><input name="price" value="<?php if(isset($results[0]['price'])) echo $results[0]['price']; ?>" type="text" class="textbox" size="10" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['sale_price2'];?></strong><br /> | <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['sale_price2'];?></strong><br /> | |
| <?php echo $lang['admin']['products']['sale_mode_desc'];?> </td> | <?php echo $lang['admin']['products']['sale_mode_desc'];?> </td> | |
| <td><input name="sale_price" value="<?php if(isset($results[0]['sale_price'])) echo $results[0]['sale_price']; ?>" type="text" class="textbox" size="10" /></td> | <td><input name="sale_price" value="<?php if(isset($results[0]['sale_price'])) echo $results[0]['sale_price']; ?>" type="text" class="textbox" size="10" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText"><strong><?php echo $lang['admin']['products']['prod_weight'];?></strong></td> | <td class="tdText"><strong><?php echo $lang['admin']['products']['prod_weight'];?></strong></td> | |
| <td class="tdText"><input name="prodWeight" type="text" class="textbox" size="10" value="<?php if(isset($results[0]['prodWeight'])) echo $results[0]['prodWeight']; ?>" /> <?php echo $config['weightUnit']; ?></td> | <td class="tdText"><input name="prodWeight" type="text" class="textbox" size="10" value="<?php if(isset($results[0]['prodWeight'])) echo $results[0]['prodWeight']; ?>" /> <?php echo $config['weightUnit']; ?></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText"><strong><?php echo $lang['admin']['products']['tax_class'];?></strong></td> | <td class="tdText"><strong><?php echo $lang['admin']['products']['tax_class'];?></strong></td> | |
| <td class="tdText"> | <td class="tdText"> | |
| <select name="taxType"> | <select name="taxType"> | |
| <?php | <?php | |
| $taxTypes = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_taxes"); | $taxTypes = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_taxes"); | |
| ?> | ?> | |
| <?php for($i=0; $i<count($taxTypes);$i++){ ?> | <?php for($i=0; $i<count($taxTypes);$i++){ ?> | |
| <option value="<?php echo $taxTypes[$i]['id']; ?>" <?php if(isset($results[0]['taxType']) && $taxTypes[$i]['id'] == $results[0]['taxType']) echo "selected='selected'"; ?>><?php echo $taxTypes[$i]['taxName']; ?> (<?php echo $taxTypes[$i]['percent']; ?>%)</option> | <option value="<?php echo $taxTypes[$i]['id']; ?>" <?php if(isset($results[0]['taxType']) && $taxTypes[$i]['id'] == $results[0]['taxType']) echo "selected='selected'"; ?>><?php echo $taxTypes[$i]['taxName']; ?> (<?php echo $taxTypes[$i]['percent']; ?>%)</option> | |
| <?php } ?> | <?php } ?> | |
| </select> | </select> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText"><strong><?php echo $lang['admin']['products']['stock_level2'];?><br /> | <td class="tdText"><strong><?php echo $lang['admin']['products']['stock_level2'];?><br /> | |
| </strong><?php echo $lang['admin']['products']['reduce_stock_level'];?> </td> | </strong><?php echo $lang['admin']['products']['reduce_stock_level'];?> </td> | |
| <td class="tdText"><input name="stock_level" value="<?php if(isset($results[0]['stock_level'])) echo $results[0]['stock_level']; ?>" type="text" class="textbox" size="10" /></td> | <td class="tdText"><input name="stock_level" value="<?php if(isset($results[0]['stock_level'])) echo $results[0]['stock_level']; ?>" type="text" class="textbox" size="10" /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText"><strong><?php echo $lang['admin']['products']['use_stock_q'];?></strong></td> | <td class="tdText"><strong><?php echo $lang['admin']['products']['use_stock_q'];?></strong></td> | |
| <td class="tdText"> | <td class="tdText"> | |
| <?php echo $lang['admin']['yes'];?> | <?php echo $lang['admin']['yes'];?> | |
| <input name="useStockLevel" type="radio" value="1" <?php if(isset($results[0]['useStockLevel']) && $results[0]['useStockLevel']==1) { echo "checked='checked'"; } elseif(!isset($results[0]['useStockLevel'])) { echo "checked='checked'"; } ?> /> | <input name="useStockLevel" type="radio" value="1" <?php if(isset($results[0]['useStockLevel']) && $results[0]['useStockLevel']==1) { echo "checked='checked'"; } elseif(!isset($results[0]['useStockLevel'])) { echo "checked='checked'"; } ?> /> | |
| <?php echo $lang['admin']['no'];?> | <?php echo $lang['admin']['no'];?> | |
| <input name="useStockLevel" type="radio" value="0" <?php if(isset($results[0]['useStockLevel']) && $results[0]['useStockLevel']==0) echo "checked='checked'"; ?> /></td> | <input name="useStockLevel" type="radio" value="0" <?php if(isset($results[0]['useStockLevel']) && $results[0]['useStockLevel']==0) echo "checked='checked'"; ?> /></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?></strong> | <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?></strong> | |
| </td> | </td> | |
| <td class="tdText"><?php echo $lang['admin']['products']['tangible'];?><span class="tdText"> | <td class="tdText"><?php echo $lang['admin']['products']['tangible'];?><span class="tdText"> | |
| <input name="digital" onclick="digitalDir.className='hiddenTextbox';digitalDir.value=''" type="radio" value="0" <?php if(isset($results[0]['digital']) && $results[0]['digital']==0) { echo "checked='checked'"; } elseif(!isset($results[0]['digital'])) { echo "checked='checked'"; } ?> /> | <input name="digital" onclick="digitalDir.className='hiddenTextbox';digitalDir.value=''" type="radio" value="0" <?php if(isset($results[0]['digital']) && $results[0]['digital']==0) { echo "checked='checked'"; } elseif(!isset($results[0]['digital'])) { echo "checked='checked'"; } ?> /> | |
| </span> <?php echo $lang['admin']['products']['digital'];?><span class="tdText"> | </span> <?php echo $lang['admin']['products']['digital'];?><span class="tdText"> | |
| <input name="digital" onclick="digitalDir.className='dirTextbox'" type="radio" value="1" <?php if(isset($results[0]['digital']) && $results[0]['digital']==1) { echo "checked='checked'"; } ?> /> | <input name="digital" onclick="digitalDir.className='dirTextbox'" type="radio" value="1" <?php if(isset($results[0]['digital']) && $results[0]['digital']==1) { echo "checked='checked'"; } ?> /> | |
| <input name="digitalDir" type="text" id="digitalDir" value="<?php if(isset($results[0]['digitalDir'])) echo $results[0]['digitalDir']; ?>" maxlength="255" <?php if(isset($results[0]['digitalDir']) && $results[0]['digital']==1) { echo "class='dirTextbox'"; } else { ?>class="hiddenTextbox" <?php } ?> /> | <input name="digitalDir" type="text" id="digitalDir" value="<?php if(isset($results[0]['digitalDir'])) echo $results[0]['digitalDir']; ?>" maxlength="255" <?php if(isset($results[0]['digitalDir']) && $results[0]['digital']==1) { echo "class='dirTextbox'"; } else { ?>class="hiddenTextbox" <?php } ?> /> | |
| <br /> | <br /> | |
| <?php echo $lang['admin']['products']['digi_path'];?></span></td> | <?php echo $lang['admin']['products']['digi_path'];?></span></td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td class="tdText"><strong><?php echo $lang['admin']['products']['show_featured'];?></strong></td> | <td class="tdText"><strong><?php echo $lang['admin']['products']['show_featured'];?></strong></td> | |
| <td class="tdText"> | <td class="tdText"> | |
| <select name="showFeatured" class="textbox"> | <select name="showFeatured" class="textbox"> | |
| <option value="1" <?php if(isset($results[0]['showFeatured']) && $results[0]['showFeatured']==1) echo "selected='selected'"; ?>><?php echo $lang['admin']['yes'];?></option> | <option value="1" <?php if(isset($results[0]['showFeatured']) && $results[0]['showFeatured']==1) echo "selected='selected'"; ?>><?php echo $lang['admin']['yes'];?></option> | |
| <option value="0" <?php if(isset($results[0]['showFeatured']) && $results[0]['showFeatured']==0) echo "selected='selected'"; ?>><?php echo $lang['admin']['no'];?></option> | <option value="0" <?php if(isset($results[0]['showFeatured']) && $results[0]['showFeatured']==0) echo "selected='selected'"; ?>><?php echo $lang['admin']['no'];?></option> | |
| </select> | </select> | |
| </td> | </td> | |
| </tr> | </tr> | |
| <tr> | <tr> | |
| <td width="25%"> </td> | <td width="25%"> </td> | |
| <td> | <td> | |
| <input type="hidden" name="oldCatId" value="<?php if(isset($results[0]['cat_id'])) echo $results[0]['cat_id']; ?>" /> | <input type="hidden" name="oldCatId" value="<?php if(isset($results[0]['cat_id'])) echo $results[0]['cat_id']; ?>" /> | |
| <input type="hidden" name="productId" value="<?php if(isset($results[0]['productId'])) echo $results[0]['productId']; ?>" /> | <input type="hidden" name="productId" value="<?php if(isset($results[0]['productId'])) echo $results[0]['productId']; ?>" /> | |
| <input type="submit" name="Submit" class="submit" value="<?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } ?> <?php echo $lang['admin']['products']['product'];?>" /></td> | <input type="submit" name="Submit" class="submit" value="<?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } ?> <?php echo $lang['admin']['products']['product'];?>" /></td> | |
| </tr> | </tr> | |
| </table> | </table> | |
| <br /> | <br /> | |
| <div class="tdText"><em><u><strong><?php echo $lang['admin']['products']['digi_info'];?></strong></u></em> | <div class="tdText"><em><u><strong><?php echo $lang['admin']['products']['digi_info'];?></strong></u></em> | |
| <?php echo $lang['admin']['products']['digi_desc'];?> | <?php echo $lang['admin']['products']['digi_desc'];?> | |
| </div> | </div> | |
| </form> | </form> | |
| <?php } ?> | <?php } ?> | |
| <?php include("../includes/footer.inc.php"); ?> | <?php include("../includes/footer.inc.php"); ?> |